<template>
  <div class="leftnav">
    <div class="mons">
      <el-row class="tac">
        <el-col :span="24">
          <el-menu
            default-active="1"
            class="el-menu-vertical-demo"
            @open="handleOpen"
            @select="onactive"
            @close="handleClose"
            text-color="rgb(48, 48, 48)"
            active-text-color="rgb(48, 48, 48)"
           
          >
            <el-menu-item index="1" :class="[indexs == 1 ? 'active' : '']">
              <!-- <i class="el-icon-menu"></i> -->
              <div :class="[indexs == 1 ? 'activetext' : '', 'nans']">
                <span slot="title">发现音乐</span>
              </div>
            </el-menu-item>
            <el-menu-item index="2" :class="[indexs == 2 ? 'active' : '']">
              <!-- <i class="el-icon-document"></i> -->
              <div :class="[indexs == 2 ? 'activetext' : '', 'nans']">
                <span slot="title">博客</span>
              </div>
            </el-menu-item>
            <el-menu-item index="3" :class="[indexs == 3 ? 'active' : '']">
              <!-- <i class="el-icon-setting"></i> -->
              <div :class="[indexs == 3 ? 'activetext' : '', 'nans']">
                <span slot="title">视频</span>
              </div>
            </el-menu-item>
            <el-menu-item index="4" :class="[indexs == 4 ? 'active' : '']">
              <!-- <i class="el-icon-setting"></i> -->
              <div :class="[indexs == 4 ? 'activetext' : '', 'nans']">
                <span slot="title">关注</span>
              </div>
            </el-menu-item>
            <el-menu-item index="5">
              <!-- <i class="el-icon-setting"></i> -->
              <span slot="title">直播</span>
            </el-menu-item>
            <el-menu-item index="6">
              <!-- <i class="el-icon-setting"></i> -->
              <span slot="title">私人FM</span>
            </el-menu-item>
            <el-menu-item disabled>
              <!-- <i class="el-icon-setting"></i> -->
              <span slot="title">我的音乐</span>
            </el-menu-item>
            <el-menu-item index="7">
              <!-- <i class="el-icon-setting"></i> -->
              <div class="ytubiao">
                <div class="biaoq">
                  <img src="../assets/xz.png" alt="" />
                </div>
                <span slot="title">本地下载</span>
              </div>
            </el-menu-item>

            <el-menu-item index="8">
              <!-- <i class="el-icon-setting"></i> -->
              <div class="ytubiao">
                <div class="biaoq">
                  <img src="../assets/zj.png" alt="" />
                </div>
                <span slot="title">最近播放</span>
              </div>
            </el-menu-item>
            <el-menu-item index="9">
              <!-- <i class="el-icon-setting"></i> -->
              <div class="ytubiao">
                <div class="biaoq">
                  <img src="../assets/yu.png" alt="" />
                </div>
                <span slot="title">我的音乐云</span>
              </div>
            </el-menu-item>
            <el-menu-item index="10">
              <!-- <i class="el-icon-setting"></i> -->
              <div class="ytubiao">
                <div class="biaoq">
                  <img src="../assets/sc.png" alt="" />
                </div>
                <span slot="title">我的收藏</span>
              </div>
            </el-menu-item>
            <el-submenu index="11">
              <template slot="title">
                <!-- <i class="el-icon-location"></i> -->
                <span>创建歌单</span>
              </template>
              <el-menu-item-group>
                <template slot="title">分组一</template>
                <el-menu-item index="1-1">选项1</el-menu-item>
                <el-menu-item index="1-2">选项2</el-menu-item>
              </el-menu-item-group>
              <el-menu-item-group title="分组2">
                <el-menu-item index="1-3">选项3</el-menu-item>
              </el-menu-item-group>
              <el-submenu index="1-4">
                <template slot="title">选项4</template>
                <el-menu-item index="1-4-1">选项1</el-menu-item>
              </el-submenu>
            </el-submenu>
            <el-submenu index="12">
              <template slot="title">
                <!-- <i class="el-icon-location"></i> -->
                <span>收藏歌单</span>
              </template>
              <el-menu-item-group>
                <template slot="title">分组一</template>
                <el-menu-item index="1-1">选项1</el-menu-item>
                <el-menu-item index="1-2">选项2</el-menu-item>
              </el-menu-item-group>
              <el-menu-item-group title="分组2">
                <el-menu-item index="1-3">选项3</el-menu-item>
              </el-menu-item-group>
              <el-submenu index="1-4">
                <template slot="title">选项4</template>
                <el-menu-item index="1-4-1">选项1</el-menu-item>
              </el-submenu>
            </el-submenu>
          </el-menu>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      indexs: 1,
      routers: [
        {
          to: "/home",
          litle:"发现音乐"
        },
        { to: "/boke" ,
          litle:"博客"},
        {
          to: "/video",
           litle:"视频"
        },
        {
          to: "/attention",
              litle:"关注"
        },
        {
          to: "/live",
               litle:"直播"
        },
        {
          to: "/privatefm",
             litle:"私人FM"
        },
        {
          to: "/download",
             litle:"本地下载"
        },
        {
          to: "/storage",
           litle:"我的音乐云"
        },
        {
          to: "/collect",
           litle:"我的收藏"
        },
      ],
    };
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log("事件1");
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
      console.log("事件2");
    },
    onactive(key, keyPath) {
      console.log(key, keyPath);
      this.indexs = key;
      console.log(this.indexs);
      this.$router.push(this.routers[this.indexs - 1].to);
    },
  },
};
</script>

<style lang="less" scoped>
.activetext {
  span {
    font-size: 17px;
    font-weight: 600;
  }
}
/deep/.el-menu-item {
  padding-left: 10px !important;
  // padding: 0!important;
  margin-top: 2px;
  border-radius: 3px;
  height: 40px;
  line-height: 40px;
}
.nans {
  // border: 1px solid #000;
}
/deep/.el-menu {
  border-radius: 5px;
  margin-left: 20px;
  margin-right: 5px;

  // border:none;
  border: 1px solid rgb(255, 255, 255);
}
.active {
  background-color: #f6f6f7 !important;
}
/deep/.el-menu-item:hover {
  background-color: #f6f6f7 !important;
}
.ytubiao {
  display: flex;
  align-items: center;
  .biaoq {
    width: 20px;
    height: 20px;
    // border: 1px solid #000;
    margin-right: 5px;
    display: flex;
    align-items: center;
    justify-content: center;

    img {
      width: 100%;
      height: 100%;
    }
  }
}

.leftnav {
  //   height: 100%;
  //   margin-top: 20px;
  //   margin-bottom: 20px;
  .mons {
    margin-top: 20px;
    padding-bottom: 120px;
  }
  .tac {
    // width: 100%;
  }
  .biaoqian {
    margin-left: 20px;
    margin-right: 5px;
  }
}
</style>